import jdk.nashorn.internal.ir.IfNode;

import java.util.Date;
import java.util.List;

public class ListNode {
    int val;
    ListNode next = null;
    public ListNode(int val) {
      this.val = val;
   }

   public static ListNode getLList(List<Integer> list){
        ListNode head = new ListNode(-1);
        ListNode current = head;
        for (Integer integer : list) {
           current.next = new ListNode(integer);
           current = current.next;
       }
        return head.next;
   }


   public static void print(ListNode head) {
       while (head != null) {
           System.out.println(head.val+ "");
           head = head.next;
       }
   }
 }
